<div class="container">
  <div class="row">
    <%= if !@sidebar_hidden do %>
    <div class="col-md-2">
      <h2>Explore</h2>

      <ul class="nav flex-column">
        <%= nav_link("Featured", Routes.explore_path(@conn, :featured), @category == :featured) %>
        <%= nav_link("All Public", Routes.explore_path(@conn, :public), @category == :public) %>
      </ul>
    </div>
    <% end %>

    <div class="col-md-<%= if @sidebar_hidden, do: 12, else: 10 %>">
      <div class="row">
        <div class="col-md-6">
          <h2><%= @page_title %></h2>
        </div>

        <div class="col-md-6 text-right">
          <div class="sorting">
            <span>Sort by </span>

            <div class="btn-group btn-group-sm">
              <%= active_link "date", @order == :date, to: "?order=date", class: "btn btn-light" %>
              <%= active_link "popularity", @order == :popularity, to: "?order=popularity", class: "btn btn-light" %>
            </div>
          </div>
        </div>
      </div>

      <div class="row asciicast-list">
        <div class="col">
          <%= for asciicasts <- Enum.chunk_every(@page, 2, 2) do %>
            <div class="row">
              <%= for asciicast <- asciicasts do %>
                <div class="col-md-6">
                  <%= render "_card.html", conn: @conn, asciicast: asciicast %>
                </div>
              <% end %>
            </div>
          <% end %>
        </div>
      </div>

      <%= if @page.total_pages > 1 do %>
        <div class="row">
          <div class="col">
            <%= pagination_links @page, order: @order %>
          </div>
        </div>
      <% end %>
    </div>
  </div>
</div>
